<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.dnanalytics.net/solvertests"
    xmlns="http://www.dnanalytics.net/solvertests" elementFormDefault="qualified">

    <xs:element name="SolverTests">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="Solvers"/>
                <xs:element ref="Preconditioners"/>
                <xs:element ref="ConvergenceMonitors"/>
                <xs:element ref="Matrices"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="Solvers">
        <xs:complexType>
            <xs:sequence maxOccurs="unbounded">
                <xs:element ref="Solver"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="Solver">
        <xs:complexType>
            <!--Descriptive name of the test-->
            <xs:attribute name="name" type="xs:string" use="required"/>

            <xs:attribute name="type" use="required">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:enumeration value="direct"/>
                        <xs:enumeration value="iterative"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
            <xs:attribute name="class" use="required">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:enumeration value="BiConjugateGradientStabilizedSolver"/>
                        <xs:enumeration value="LU"/>
                        <xs:enumeration value="QR"/>
                        <xs:enumeration value="SVD"/>
                        <xs:enumeration value="Cholesky"/>
                        <xs:enumeration value="Levinson"/>
                        <xs:enumeration value="SymmetricLevinson"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
            <xs:attribute name="matrixtype" use="required">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:enumeration value="Dense"/>
                        <xs:enumeration value="Sparse"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
            <xs:attribute name="preconditioner" type="xs:IDREF" use="optional"/>
            <xs:attribute name="monitor" type="xs:IDREF" use="optional"/>
        </xs:complexType>
    </xs:element>
    
    <xs:element name="Preconditioners">
        <xs:complexType>
            <xs:sequence maxOccurs="unbounded">
                <xs:element ref="Preconditioner"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="Preconditioner">
        <xs:complexType>
            <xs:attribute name="ID" type="xs:ID" use="required"/>
            <xs:attribute name="class" use="required">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:enumeration value="DiagonalIncompleteLUFactorization "/>
                        <xs:enumeration value="DiagonalPreconditioner "/>
                        <xs:enumeration value="IlutpPreconditioner"/>
                        <xs:enumeration value="IncompleteLUFactorization "/>
                        <xs:enumeration value="UnitPreconditioner"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
            <xs:attribute name="matrixtype" use="required">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:enumeration value="Dense"/>
                        <xs:enumeration value="Sparse"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
        </xs:complexType>
    </xs:element>

    <xs:element name="ConvergenceMonitors">
        <xs:complexType>
            <xs:sequence maxOccurs="unbounded">
                <xs:element ref="ConvergenceMonitor"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="ConvergenceMonitor">
        <xs:complexType>
            <xs:attribute name="ID" type="xs:ID" use="required"/>
            <xs:attribute name="maximumIterations" type="xs:int" use="optional" default="100"/>
            <xs:attribute name="maximumResidual" type="xs:double" use="optional" default="1e-10"/>
            <xs:attribute name="matrixNorm" type="xs:double" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="Matrices">
        <xs:complexType>
            <xs:sequence maxOccurs="unbounded">
                <xs:element ref="Matrix"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    
    <xs:element name="Matrix">
        <xs:complexType>
            <xs:attribute name="ID" type="xs:ID" use="required"/>
            <xs:attribute name="type" use="required">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:enumeration value="Dense"/>
                        <xs:enumeration value="Sparse"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
            <xs:attribute name="file" type="xs:anyURI" use="required"/>
        </xs:complexType>
    </xs:element>

</xs:schema>